home *** CD-ROM | disk | FTP | other *** search
- LSORT 3.41 (C) Copyright London Computing, 1983-1991.
- All rights reserved.
-
- LSORT is a general purpose sort/merge utility written in Microsoft C
- 6.0 for DOS 3.30 and above and OS2 1.2 and above written as a family
- mode application. It runs on IBM PCs and compatibles with at least
- 512KB and either two floppy disks or a fixed disk.
-
- LSORT is User Supported Software, if this program proves useful, please
- make a contribution ($35 suggested) to:
-
- London Computing, P.O. Box 696 Cherry Hill, NJ 08003
-
- Anyone sending a contribution will receive a disk containing the source code
- to LSORT as well as a copy of the LSRT sort filter. LSRT is similar to the
- DOS SORT filter but works much faster and will sort on multiple fields.
-
- You may make copies of this software and distribute to other users as long as
- there is no charge or other consideration and this notice is not removed or
- bypassed.
-
- LSORT will sort MSDOS and OS2 files and dBase II and dBase III
- databases. (dBase III memo files and FOXPRO memo files are not sorted
- but .DBF files will be sorted.) Each file may be sorted using 1 to 32
- sort fields. The file to be sorted may contain either fixed length
- records, variable length records or comma delimited records. Variable
- length records are records ending with cr/lf. Comma delimited records
- are variable length records where the fields are also variable length
- and separated by a comma. Character fields may be enclosed in either
- single or double quotes. It will merge up to 5 files using 1 to 32
- sort fields. dBase databases may not be merged. Any field may be
- sorted in either ascending or descending sequence. LSORT allows for
- three user defined field types to be used: X,Y and Z. You must write
- your own comparison subroutine to compare user defined fields.
-
- The sort knows about: field type
-
- binary fields (to 127 bytes) B
- Binary Fields are sorted from left to right
- one byte at a time based on the code in each
- position (0-255). Useful for comparing
- IBM Mainframe style binary numbers.
- packed decimal fields (1-8 bytes) Stored as on P
- IBM Mainframe computers. Each digit position
- is stored in 4 bits as a binary value between
- 0 and 10. The digits are stored left to
- right with the rightmost position containing
- a sign, 0x0D for negative, 0x0C or 0x0F for
- positive. A packed decimal field can store
- between 1 and 15 digits depending on the
- length of the field. If an invalid sign
- field is specified, the sort won't produce
- what you would expect. Packed decimal values
- are only meaningful in fixed length record.
- character fields (to 127 bytes) C
- Character fields compare up to the first
- binary zero in the field, following the C
- language conventions for character strings.
- upper case character fields (sort fields are U
- translated to upper case before compare)
- 2 byte integers in internal format I
- 4 byte integers in internal format L
- floating point numbers (ieee) F
- double precision floating point (ieee) D
- zoned decimal numbers N
- (Text format numbers, Decimals are allowed)
- (LSORT now supports scientific notation as)
- (well, using E notation, eg. .98 == 9.8E-1)
- (xBase N and F fields are sorted as type Z)
- 1 byte logical fields (dBase II or III) T
- User defined field type X X
- User defined field type Y Y
- User defined field type Z Z
-
- A zoned decimal number is stored as a character string and may contain
- leading and trailing spaces, minus sign, decimal point and digits.
-
- NOTE: zoned decimal numbers and comma delimitted files sort very slowly!
- The only reasonable field types for comma delimited files are C or N. LSORT
- will accept other field types, but the results are undefined.
-
-
- LSORT will prompt you for all parameters and file names or you may specify
- some or all of the parameters on the command line when you invoke the sort.
-
- The maximum record length is 4096 bytes. Files will be sorted in memory if
- possible.
-
- Files larger than available memory are sorted in pieces and then merged
- together. If you have a floppy only system, you should have LSORT on the A
- drive and the file to be sorted on the B drive. Place a copy of LSORT on an
- otherwise empty disk and use as your A drive. You may need a formatted empty
- disk for work files on the B drive.
-
-
- SYNTAX:
-
-
- LSORT [-h | -m] -- will prompt you for all necessary information.
- or
- LSORT [-h | -m] sort specifications--will take the specification specified and
- prompt you for any others.
-
- Specify -h if you are using a fixed (hard disk) for your output and
- merge files. This will eliminate mount messages. This is the default
- for LSORT 3.01 and above. Specify -m if you are using mountable disks
- (floppy, Bournouli, etc.). This allows you to mount disks to contain
- work files and output files.
-
- or
-
- LSORT -R -- will restart a sort.
-
-
- Sort Specifications:
-
- You will be asked to specify either a SORT or MERGE operation.
-
- If you ask for a SORT, you may tell LSORT to use either a QUICKSORT or
- HEAPSORT for internal sorting. You will also be asked to specify two
- devices to hold merge files if any are needed. Merge files may be placed on
- floppy disk, hard disk or RAM disk. The specified drive must be large
- enough to hold the entire input file. You will be given the opportunity to
- change floppy disks if desired before each merge drive is used and before
- the output file is written. The program will wait for you to press 'Y'
- before proceeding. This is not really a problem for unattended sorting
- if you use redirected input or specify all prompts on the command line.
-
- If you specify SORT or MERGE you will be prompted for your input file(s) and
- output file as well as the definition of the key fields to be used in the
- comparisons. Fields are specified by their starting position and length.
- The types of fields have been listed above.
-
- The sort specifications may be entered on the command line in the order
- requested by LSORT. Each parameter should be separated from the others with
- one or more spaces. You will not be prompted for any specification on the
- command line (including requests to change disks).
-
- The sort will ask for the following information in the order shown:
-
- Type of Sort: You may reply:
- S -- for QUICKSORT
- H -- for HEAPSORT
-
- Merge Drive 1: You may reply with any drive letter, although it is best to
- specify a fixed disk (if any).
-
-
- Merge Drive 2: This should be different from drive 1 if you are using
- floppy disks, but should be a fixed disk if you have one.
-
- Name of input file: You may specify any name including drive letter and
- path. Specify :X to use a user specified input routine.
-
- Name of output file: See above. Specify :X to use a user specified output
- routine.
-
- File Type (Unless you are sorting a dBase file): You may reply F for a
- fixed length file (all records are the same length), V for a varying
- length file (records must end with CR LF.) or D for comma delimited files.
-
-
- If you entered 'F' for a fixed file, you will be prompted for the record
- length.
-
- You will then be prompted for field definitions. Each field definition has
- four parts: starting position (from 1) or starting field (delimited files)
- field length (in bytes) (no prompt for delimited files)
- field type (See above list of valid types)
- sort order (A--Ascending, D--Descending)
-
- In order to work as efficiently as possible, LSORT does not check the
- starting position of a field against the actual length of a record. If some
- field starts past the end of a record (e.g. sort field 1 starts in column 10
- but the record is only 8 bytes long), the results will be undefined and most
- certainly not what you want. Please be careful.
-
- Enter a '0' for the starting position to end the prompt for field
- definitions.
-
- If you are sorting a dBase file, you will see a list of fields. You may
- specify a field by name, in which case you will only be prompted for the
- sort order or you may enter starting position, length, type and order as
- above.
-
- Following the '0' that ends field definitions, you may specify a series of
- 'Y's if you know that the disks currently mounted will hold merge work files
- and the output file. These may be omitted if you specified the -H flag.
-
- example 1:
-
- Sort file test.dat on positions 1-5,char,ascending and 6-7, binary integer,
- descending. Use drive C for the work files and put the sorted file in
- test.srt.
-
- Issue the following command:
-
- LSORT S C C test.dat test.srt V 1 5 C A 6 2 H D 0 Y Y Y
- | | | | | | |_____| |_____| | | | |
- | | | input output F | | | | | response to mount
- | | | file file i sort sort | | | output file message.
- | | | name name l field 1 field 2 | | |
- | | | e starts starts | | response to mount 2nd
- | | merge drive 2 at byte at byte | | merge volume message.
- | | T 1, is 5 6, is 2 | |
- | merge drive 1 y byte byte | response to mount first
- | p char- long | merge volume message.
- sort using e acter integer |
- quicksort string sorted ends list of sort fields.
- ascend- descend-
- ing ing
-
-
-
- Merge Specification:
-
- Enter 'M' to indicate the merge operation.
-
- You will be asked to enter the number of files to be merged followed by 1-5
- files to be merged. They are entered one at a time.
-
- You will be asked to enter a file type, output file and a field list as
- above.
-
- example:
-
- Merge files t1.dat t2.dat and t3.dat on positions 4-7 defined as a character
- field, ascending.
-
- LSORT M 3 t1.dat t2.dat t3.dat test.mrg V 4 4 c a 0 y y
- | | | | | | | |_____| | |_|
- | | input input input output | | | |
- | | file 1 file 2 file 3 file | merge | response to mount
- | | | field | messages
- | merge 3 files | 1 |
- | | end of list of merge
- do a merge file fields
- type
-